﻿
Partial Class Controls_wctlPersonalDisponibilidadListar
    Inherits System.Web.UI.UserControl
    Dim cBLPersonal As New BLGestionProyecto.BLGPPersonal
    Dim cBLProyecto As New BLGestionProyecto.BLGPProyecto
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try

            If Not Page.IsPostBack Then
                txtCodigo.Text = cBLPersonal.fuBLBuscarPersonalx(Session("PersonaID")).Rows(0).Item(0).ToString
                txtNombrePersona.Text = cBLPersonal.fuBLBuscarPersonalx(Session("PersonaID")).Rows(0).Item(1).ToString + " " + _
                    cBLPersonal.fuBLBuscarPersonalx(Session("PersonaID")).Rows(0).Item(2).ToString + " " + _
                    cBLPersonal.fuBLBuscarPersonalx(Session("PersonaID")).Rows(0).Item(2).ToString
                'cargar actividades y marchar check
                If Session("CheckOrigen") = "Nuevo" Then
                    chkNuevaAsignacion.Checked = True
                    chkReemplazo.Checked = False
                ElseIf Session("CheckOrigen") = "Reemplazo" Then
                    chkNuevaAsignacion.Checked = False
                    chkReemplazo.Checked = True
                End If

            End If
        Catch ex As Exception
            lblmensaje.Text = ex.ToString
        End Try
    End Sub

    Protected Sub btnCancelar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancelar.Click
        Response.Redirect("wfrmSeleccionarPersonas.aspx")
    End Sub

    Protected Sub btnAceptar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAceptar.Click
        Try
            'Insertar en la tabla ProyectoAsignacion

            cBLProyecto.fuBLInsertarProyectoAsignacion(Session("ProyectoId"), Convert.ToInt16(txtCodigo.Text))
            Response.Redirect("wfrmProyectoGrupoTrabajo.aspx")
        Catch ex As Exception
            lblmensaje.Text = ex.ToString
        End Try

    End Sub

    Protected Sub txtCodigo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtCodigo.TextChanged

    End Sub
End Class
